#!/bin/bash
set -x

# arango data
IMAGE_DUMP_DIR=/home/dig/graph_data/image_data
cd ${IMAGE_DUMP_DIR}

dirs=`ls -a |grep data_parsed_20|grep -v tar|awk '{print $NF}'`
for dir in ${dirs}
do
    if [ -d "${dir}" -a -f "${dir}/lz" -a -f "${dir}/imped" ];then
        rm -rf ${dir}
    fi
done

# mongo data
cd /home/dig/graph_data/mongo_data

touch -t `date -d '30 days ago' +%Y%m%d%H%M` 30days
find . -maxdepth 1 -name "app_data_*.tar_bak" -type f ! -newer 30days | xargs rm -rf



